
#ifndef APPLE_APP_STUB_H
#define APPLE_APP_STUB_H

#ifdef  __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdint.h>

typedef signed char             int8;
typedef signed short            int16;
typedef signed long             int32;
typedef signed long long        int64;
typedef unsigned char           uint8;
typedef unsigned short          uint16;
typedef unsigned long           uint32;
typedef unsigned long long      uint64;
typedef int            ipod_t;

typedef int32_t		StubAirPlayEntity;
#define kStubAirPlayEntity_NotApplicable			0
#define kStubAirPlayEntity_Controller				1
#define kStubAirPlayEntity_Accessory				2

// AirPlaySpeechMode

typedef int32_t		StubAirPlaySpeechMode;
#define kStubAirPlaySpeechMode_NotApplicable			0
#define kStubAirPlaySpeechMode_None						-1 // No speech-related states are active.
#define kStubAirPlaySpeechMode_Speaking					1  // Device is speaking to the user.
#define kStubAirPlaySpeechMode_Recognizing				2  // Device is recording audio to recognize speech from the user.


// State

typedef struct
{
	StubAirPlayEntity			entity;
	StubAirPlaySpeechMode		mode;

}	StubAirPlaySpeechState;

typedef struct
{
	StubAirPlayEntity			screen;			// Current user of the screen.
	StubAirPlayEntity			permScreen;		// Permanent owner of screen.
	StubAirPlayEntity			mainAudio;		// Current user of main audio.
	StubAirPlayEntity			permMainAudio;	// Permanent owner of main audio.
	StubAirPlayEntity			phoneCall;		// Owner of phone call.
	StubAirPlaySpeechState		speech;			// Owner of speech and its mode.
	StubAirPlayEntity			turnByTurn;		// Owner of navigation.

}	StubAirPlayModeState;

//===========================================================================================================================
//	CarPlayAppStubDelegate
//===========================================================================================================================
/**
 * CarPlay会话开始了
 *
 */
typedef void (*AirPlaySessionStarted)(ipod_t /*handle*/);

/**
 * CarPlay会话停止了
 *
 */
typedef void (*AirPlaySessionStoped)(ipod_t /*handle*/);


typedef struct
{
    AirPlaySessionStarted               airPlaySessionStarted_f;
    AirPlaySessionStoped                airPlaySessionStoped_f;

} CarPlayAppStubDelegate;

#define CarPlayAppStubDelegateInit( PTR )	memset( (PTR), 0, sizeof( CarPlayAppStubDelegate ) );

void CarPlayAppStubSetDelegate( const CarPlayAppStubDelegate *inDelegate );

int	StartAppleCarPlay( int argc, char **argv );
int	DestroyAppleCarPlay();



#ifdef  __cplusplus
}  
#endif
#endif //APPLE_APP_STUB_H
